namespace Study208 {

  // 定义一个动物类
  class Animal {
    // 名称属性
    name: string;

    constructor(name: string) {
      this.name = name;
    }
    // 定义移动方法
    move(distance: number = 0) {
      console.log(`${this.name} moved ${distance} meters.`);
    }
  }
  // 定义一个鸟类继承动物类
  class Bird extends Animal {
    // 初始化鸟类属性 展翅次数 wingspan 
    constructor(name: string, public wingspan: number) {
      super(name); // 调用父类的构造函数
    }

    fly(distance: number) {
      console.log(`${this.name} is flying with a wingspan of ${this.wingspan} meters.`);
      super.move(distance); // 调用父类的方法
    }
  }

  const bird = new Bird('Eagle', 2);
  bird.fly(20); // Eagle is flying with a wingspan of 2 meters. Eagle moved 20 meters.


}

export {}